package com.sqx.modules.creation.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.Result;
import com.sqx.modules.creation.dao.FollowsUserDao;
import com.sqx.modules.creation.entity.NFollowsUser;
import com.sqx.modules.creation.service.FollowsUserService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;

@Service
public class FollowsUserServiceImpl  extends ServiceImpl<FollowsUserDao, NFollowsUser> implements FollowsUserService {

    @Override
    public Result myFollowsUser(Long userId,Integer page,Integer limit) {
        Page<NFollowsUser> userPage = new Page<>(ObjectUtils.isEmpty(page) ? 1 : page, ObjectUtils.isEmpty(limit) ? 10 : limit);
        LambdaQueryWrapper<NFollowsUser> followsUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
        followsUserLambdaQueryWrapper.eq(NFollowsUser::getUserId, userId);
        return Result.success().put("data",baseMapper.selectPage(userPage,followsUserLambdaQueryWrapper));
    }


}
